﻿using System.Windows.Media;

namespace System.Xml.Serialization.TestProject
{
    class TestSuite_ClassInheritance
    {
        internal static void TestClass_VeryImportantPerson()
        {
            string className = typeof(VeryImportantPerson).Name;

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonRoot>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonCustomRoot>("<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonCustomRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonCustomRootOverride>("<Spirit>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Spirit>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonCustomRootOverride>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Spirit>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Spirit>");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonAttribute>("<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonCustomAttribute>("<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonCustomAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonElement>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonCustomElement>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonCustomElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonCustomElementOverride>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonCustomElementOverride>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonCustomRuntimeSerializer>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonCustomRuntimeSerializer>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IVeryImportantPersonColor>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPerson, IVeryImportantPersonColor>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");
        }

        internal static void TestClass_VeryImportantPerson_Compatibility()
        {
            string className = typeof(VeryImportantPerson).Name;

            TestHelper.TestRead<VeryImportantPerson, IPersonRoot>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPerson, IPersonRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IPersonCustomRoot>("<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPerson, IPersonCustomRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Body>\r\n  <Name>John Doe</Name>\r\n</Body>");

            TestHelper.TestRead<VeryImportantPerson, IPersonAttribute>("<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPerson, IPersonAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Name=\"John Doe\" />");

            TestHelper.TestRead<VeryImportantPerson, IPersonCustomAttribute>("<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPerson, IPersonCustomAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Id=\"John Doe\" />");

            TestHelper.TestRead<VeryImportantPerson, IPersonElement>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });

            TestHelper.TestWrite<VeryImportantPerson, IPersonElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IPersonCustomElement>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPerson, IPersonCustomElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IPersonCustomElementString>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPerson, IPersonCustomElementString>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPerson, IPersonCustomElementString>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPerson, IPersonCustomElementString>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");
        }

        internal static void TestClass_IVeryImportantPersonClass()
        {
            string className = typeof(VeryImportantPersonClass).Name;

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonRoot>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonCustomRoot>("<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonCustomRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonCustomRootOverride>("<Spirit>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Spirit>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonCustomRootOverride>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Spirit>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Spirit>");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonAttribute>("<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonCustomAttribute>("<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonCustomAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonElement>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonCustomElement>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonCustomElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonCustomElementOverride>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonCustomElementOverride>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonCustomRuntimeSerializer>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonCustomRuntimeSerializer>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IVeryImportantPersonColor>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IVeryImportantPersonColor>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");
        }

        internal static void TestClass_IVeryImportantPersonClass_Compatibility()
        {
            string className = typeof(VeryImportantPersonClass).Name;

            TestHelper.TestRead<VeryImportantPersonClass, IPersonRoot>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IPersonRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IPersonCustomRoot>("<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IPersonCustomRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Body>\r\n  <Name>John Doe</Name>\r\n</Body>");

            TestHelper.TestRead<VeryImportantPersonClass, IPersonAttribute>("<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IPersonAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Name=\"John Doe\" />");

            TestHelper.TestRead<VeryImportantPersonClass, IPersonCustomAttribute>("<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IPersonCustomAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Id=\"John Doe\" />");

            TestHelper.TestRead<VeryImportantPersonClass, IPersonElement>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });

            TestHelper.TestWrite<VeryImportantPersonClass, IPersonElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IPersonCustomElement>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IPersonCustomElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IPersonCustomElementString>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IPersonCustomElementString>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonClass, IPersonCustomElementString>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonClass, IPersonCustomElementString>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");
        }

        internal static void TestClass_IVeryImportantPersonChildClass()
        {
            string className = typeof(VeryImportantPersonChildClass).Name;

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonRoot>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonCustomRoot>("<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonCustomRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonCustomRootOverride>("<Spirit>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Spirit>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonCustomRootOverride>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Spirit>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Spirit>");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonAttribute>("<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonCustomAttribute>("<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonCustomAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonElement>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonCustomElement>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonCustomElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonCustomElementOverride>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonCustomElementOverride>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonCustomRuntimeSerializer>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonCustomRuntimeSerializer>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IVeryImportantPersonColor>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IVeryImportantPersonColor>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">");
        }

        internal static void TestClass_IVeryImportantPersonChildClass_Compatibility()
        {
            string className = typeof(VeryImportantPersonChildClass).Name;

            TestHelper.TestRead<VeryImportantPersonChildClass, IPersonRoot>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IPersonRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IPersonCustomRoot>("<Body>\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</Body>",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IPersonCustomRoot>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<Body>\r\n  <Name>John Doe</Name>\r\n</Body>");

            TestHelper.TestRead<VeryImportantPersonChildClass, IPersonAttribute>("<" + className + " Name=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IPersonAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Name=\"John Doe\" />");

            TestHelper.TestRead<VeryImportantPersonChildClass, IPersonCustomAttribute>("<" + className + " Id=\"John Doe\">\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IPersonCustomAttribute>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + " Id=\"John Doe\" />");

            TestHelper.TestRead<VeryImportantPersonChildClass, IPersonElement>("<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });

            TestHelper.TestWrite<VeryImportantPersonChildClass, IPersonElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Name>John Doe</Name>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IPersonCustomElement>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IPersonCustomElement>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IPersonCustomElementString>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IPersonCustomElementString>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");

            TestHelper.TestRead<VeryImportantPersonChildClass, IPersonCustomElementString>("<" + className + ">\r\n  <Head>John Doe</Head>\r\n  <Guid>d2b07bb8-38db-4581-96d2-c23313b40c59</Guid>\r\n</" + className + ">",
                (person) =>
                {
                    return person.Name == "John Doe" && person.Id == Guid.Empty;
                });
            TestHelper.TestWrite<VeryImportantPersonChildClass, IPersonCustomElementString>(
                (person) =>
                {
                    person.Name = "John Doe"; person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                }, "<" + className + ">\r\n  <Head>John Doe</Head>\r\n</" + className + ">");
        }

        internal static void TestClass_IVeryImportantPersonColor()
        {
            string className = typeof(VeryImportantPersonColorClass).Name;

            string xml = "<" + className + ">\r\n  <Name>John Doe</Name>\r\n  <Id>d2b07bb8-38db-4581-96d2-c23313b40c59</Id>\r\n  <Color>\r\n    <A>192</A>\r\n    <R>168</R>\r\n    <G>0</G>\r\n    <B>1</B>\r\n  </Color>\r\n</" + className + ">";
            TestHelper.TestRead<VeryImportantPersonColorClass, IVeryImportantPersonColor>(xml,
                (person) =>
                {
                    return person.Name == "John Doe"
                        && person.Id == Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59")
                        && person.Color.A == 192
                        && person.Color.R == 168
                        && person.Color.G == 0
                        && person.Color.B == 1;
                });
            TestHelper.TestWrite<VeryImportantPersonColorClass, IVeryImportantPersonColor>(
                (person) =>
                {
                    person.Name = "John Doe";
                    person.Id = Guid.Parse("d2b07bb8-38db-4581-96d2-c23313b40c59");
                    person.Color = new Color() { A = 192, R = 168, G = 0, B = 1 };
                }, xml);
        }
    }
}
